home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Security
/
McAfee SiteAdvisor 26.6
/
safe.xpi
/
chrome
/
safe.jar
/
content
/
main.js
< prev
next >
Wrap
Text File
|
2007-12-04
|
12KB
|
259 lines
/*-----------------------------------------------------
Copyright (c) 2006 McAfee, Inc. All Rights Reserved.
-----------------------------------------------------*/
var upscale = 1.0;
var arrowheight=34;
var arrowwidth =35;
var borderheight=200;
var borderwidth=286*upscale;
var iconwidth=16;
var iconheight=16;
var hedge = 30; // edge of arrow to edge of bubble
var scrollbarwidth = 20;
var vpadding = 9;
var hpadding = Math.round(5*upscale);
var bubblecorner = 11*upscale;
var color;
document.onmousemove = MoveBubble;
window.addEventListener("DOMMouseScroll",shut, false);
var ct=0;
var mv=0;
function setScale(locscale) {
upscale = locscale;
borderwidth = 286*upscale;
hpadding = Math.round(5*upscale);
bubblecorner = 11*upscale;
}
function _overflow(e) {
if (e.currentTarget.id != "linktitdiv") return;
var obj = e.currentTarget;
obj.ins = document.createElement("ins");
obj.ins.innerHTML="\u2026";
obj.ins.setAttribute("style","position:absolute;right:0;text-align:right;padding-right:.9em;text-decoration:none;");
obj.appendChild(obj.ins);
}
function _underflow(e) {
if (e.currentTarget.id != "linktitdiv") return;
var obj = e.currentTarget;
if (obj.ins) obj.ins.innerHTML = "";
}
function pop(e,domain,verdict,overall,image1,image2,image3,desc1,desc2,desc3,link1,link2,col,linktitenc,locscale) {
setScale(locscale);
if (typeof(linktitenc) == 'undefined') linktitenc = domain;
if (contains(document.getElementById('stickytable'),e.relatedTarget))
return;
color = col;
bdcolor = "white";
switch (color) {
case "green":
bdcolor = "#3BA671";
break;
case "red":
bdcolor = "#E47F97";
break;
case "yellow":
bdcolor = "#FFDD55";
break;
case "white":
bdcolor = "#999999";
default:
break;
}
document.getElementById("BorderLayer").style.backgroundImage = "none";
document.getElementById("border_bg_image").src = "chrome://safe/content/" + color + "bubble.gif";
var closex="<TD ALIGN='right' style='border-bottom: 1px solid "+bdcolor+";padding-bottom:.2em;font-size:medium;'><img ONCLICK='BubbleHide()' style='height:0.8764em;padding-right:.3em;cursor:pointer;font-size:medium;' id='closebutton' border=0 onmouseout=\"document.getElementById('closebutton').src='chrome://safe/content/xup.gif';\" onmouseup=\"document.getElementById('closebutton').src='chrome://safe/content/xup.gif';\" onmousedown=\"document.getElementById('closebutton').src='chrome://safe/content/xdown.gif';\" src='chrome://safe/content/xup.gif'/></TD>";
var title = "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0' style='border-bottom:1px solid white;'><TR VALIGN='MIDDLE'><TD ALIGN='LEFT' style='border-bottom: 1px solid "+bdcolor+";padding-bottom:.2em;font-size:medium;'><img style='padding-left:.3em;height:.939em;font-size:medium;' src='chrome://safe/content/mc"+color+".gif'/></TD>"+closex+"</TR></TABLE>";
bod = "<style type=\"text/css\">ins{background:url(chrome://safe/content/"+color.charAt(0)+".png) repeat;}</style><div id=\"linktitdiv\" class='sastyle_div_headline' style=\"padding-left:.8em;padding-right:.8em;white-space:nowrap;overflow:hidden;color:black;\"></div><span class='sastyle_text_domainname' style='margin-top:6px;margin-bottom:10px;padding-left:.8em;padding-right:.8em;color:black;'>" + domain + "</span><br/><p class='sastyle_text_overallrec' style='padding-left:.8em;padding-right:.8em;float:none;margin-top:8px;line-height:13px;color:black;'>"+overall+"</p>";
var links = "";
if (verdict != "Untested.") {
bod += "<tr><td valign=center width='100%' style='padding-left:.5em;padding-right:.5em;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"ul.png) 0 0 repeat-x;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"ul.png) 0 100% repeat-x;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"l.png) 0 0 repeat-y;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"r.png) 100% 0 repeat-y;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"llc.png) 0 100% no-repeat;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"lrc.png) 100% 100% no-repeat;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"ulc.png) 0 0 no-repeat;'><div style='background:url(chrome://safe/content/"+color.charAt(0)+
"urc.png) 100% 0 no-repeat;'><table width='100%'><tr ><td align='left' style='padding:.1em;width:.8512em;' >" + image1 +
"</td><td align='left' style='padding:.1em;' colspan='2'><font class='sastyle_text_facetrec' style='color:black;'>" +
desc1 + "</font></td></tr><tr><td align='left' style='padding:.1em;width:.8512em;'>" + image2 +
"</td><td align='left' style='padding:.1em;' colspan='2' ><font class='sastyle_text_facetrec' style='color:black;'>" + desc2 +
"</font></td></tr><tr ><td align='left' style='padding:.1em;width:.8512em;'>" + image3 +
"</td><td align='left' style='padding:.1em;'><font class='sastyle_text_facetrec' style='color:black;'>" + desc3 +
"</font></td><td align='right' style=''>"+link1+"</td></tr></table></div></div></div></div></div></div></div></div></td></tr>";
links = "<table style='table-layout:fixed;' width=100%><tr width=100%><td width=100% style='' align='right'>" + link2 + "</td></tr></table>";
} else
links = "<table style='table-layout:fixed;' width=100%><tr width=100%><td style='' align='right'>" + link2 + "</td></tr></table>";
var hypertxt="<span id='"+ domain + "'></span><TABLE style='font-size:medium;font-color:black;table-layout:fixed' id='stickytable' WIDTH='100%' HEIGHT='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0'><TR VALIGN=TOP><TD style=''>"+title+"</TD></TR><TR VALIGN=TOP style='overflow:hidden'><TD style='' VALIGN=TOP>"+bod+"</TD></TR><TR VALIGN=BOTTOM><TD style=''>" + links + "</TD></TR></TABLE>"
document.getElementById("BubbleLayer").innerHTML=hypertxt;
document.getElementById("linktitdiv").addEventListener("overflow", _overflow, false);
document.getElementById("linktitdiv").addEventListener("underflow", _underflow, false);
document.getElementById("linktitdiv").innerHTML = linktitenc;
ct=0;
mv=1;
icon = e.currentTarget;
document.getElementById('BorderLayer').onmouseout = shut;
document.getElementById('InvLayer').onmouseout = shut;
document.getElementById('ArrowLayer').onmouseout = shut;
document.getElementById('BubbleLayer').onmouseout = shut;
}
function contains (container, containee) {
while (containee) {
if (container == containee) {
return true;
}
containee = containee.parentNode;
}
return false;
}
function MoveBubble(e) {
if(mv) {
var arrowlayer = document.getElementById('ArrowLayer');
var bubblelayer = document.getElementById('BubbleLayer');
var borderlayer = document.getElementById('BorderLayer');
var invlayer = document.getElementById('InvLayer');
var bgimage = document.getElementById('border_bg_image');
var arrowimage = document.getElementById('arrow_bg_image');
arrowlayer.style.width = arrowwidth*.0626 + "em";
arrowlayer.style.height = arrowheight*.0626 + "em";
borderlayer.style.width = borderwidth*.0626 + "em";
borderlayer.style.height = borderheight*.0626 + "em";
invlayer.style.width = borderwidth*.0626 + "em";
invlayer.style.height = arrowheight*.0626 + "em";
bgimage.style.width = borderlayer.style.width;
bgimage.style.height = borderlayer.style.height;
arrowimage.style.width = arrowlayer.style.width;
arrowimage.style.height = arrowlayer.style.height;
growth_factor = bgimage.height / 200.0;
var baseX = OffsetLeft(icon) + iconwidth*growth_factor / 2; // middle of the icon
var baseY = OffsetTop(icon); // top of the icon
if (baseY - arrowheight*growth_factor - borderheight*growth_factor > window.pageYOffset) { // upright
arrowlayer.style.backgroundImage = "none";
arrowimage.src = "chrome://safe/content/" + color + "downarrow.gif";
arrowlayer.style.top = (baseY - arrowheight*growth_factor) + "px";
borderlayer.style.top = (baseY - arrowheight*growth_factor - borderheight*growth_factor) + "px";
invlayer.style.top = (OffsetTop(borderlayer) + borderheight*growth_factor) + "px";
} else { // upside-down
arrowlayer.style.backgroundImage = "none";
arrowimage.src = "chrome://safe/content/" + color + "uparrow.gif";
arrowlayer.style.top = (baseY + iconheight*growth_factor) + "px";
borderlayer.style.top = (baseY + iconheight*growth_factor + arrowheight*growth_factor) + "px";
invlayer.style.top = (OffsetTop(borderlayer) - arrowheight*growth_factor) + "px";
}
if (baseX + (borderwidth*growth_factor - hedge*growth_factor) < window.pageXOffset + window.innerWidth-scrollbarwidth) { // not h-clipped
arrowlayer.style.left = baseX + "px";
borderlayer.style.left = (baseX - hedge*growth_factor) + "px";
} else { // need to slide borderlayer
borderlayer.style.left = (window.pageXOffset + window.innerWidth - borderwidth*growth_factor-scrollbarwidth) + "px";
if (baseX + arrowwidth*growth_factor > window.pageXOffset + window.innerWidth - scrollbarwidth)
arrowlayer.style.left = (window.pageXOffset + window.innerWidth - arrowwidth*growth_factor-scrollbarwidth-bubblecorner*growth_factor) + "px";
else
arrowlayer.style.left = baseX + "px";
}
bubblelayer.style.top = (OffsetTop(borderlayer) + vpadding*growth_factor) + "px";
bubblelayer.style.left = (OffsetLeft(borderlayer) + hpadding*growth_factor) + "px";
bubblelayer.style.width = (borderwidth - 2*hpadding)*.0626 + "em";
bubblelayer.style.height = (borderheight - 2*vpadding)*.0626 + "em";
invlayer.style.left = OffsetLeft(borderlayer) + "px";
if(document.location.href.match(/(suche\.web\.de)|(suche\.gmx\.net)|(\.live\.)|(\.google\.)|(\.cox\.net)|(\.goo\.)|(\.msn\.)/))
{
bubblelayer.style.zIndex = 99999;
invlayer.style.zIndex = 99999;
arrowlayer.style.zIndex = 99999;
borderlayer.style.zIndex = 99999;
}
ShowBubble();
}
}
function OffsetTop(elm) {
var t = elm.offsetTop;
while (elm.offsetParent) {
elm = elm.offsetParent;
t += elm.offsetTop;
}
return t;
}
function OffsetLeft(elm) {
var l = elm.offsetLeft;
while (elm.offsetParent) {
elm = elm.offsetParent;
l += elm.offsetLeft;
}
return l;
}
function ShowBubble() {
ct++
if(ct == 1) {
document.getElementById("BubbleLayer").style.visibility= 'visible';
document.getElementById('BorderLayer').style.visibility='visible';
document.getElementById('ArrowLayer').style.visibility='visible';
document.getElementById('InvLayer').style.visibility='visible';
mv = 0;
}
}
function BubbleHide() {
document.getElementById("BubbleLayer").style.visibility='hidden';
document.getElementById("BubbleLayer").style.left=-800;
document.getElementById("BubbleLayer").style.top=-800;
document.getElementById('BorderLayer').style.visibility = 'hidden';
document.getElementById('BorderLayer').style.left=-800;
document.getElementById('BorderLayer').style.top=-800;
document.getElementById('ArrowLayer').style.visibility = 'hidden';
document.getElementById('ArrowLayer').style.left=-800;
document.getElementById('ArrowLayer').style.top=-800;
document.getElementById('InvLayer').style.visibility = 'hidden';
document.getElementById('InvLayer').style.left=-800;
document.getElementById('InvLayer').style.top=-800;
}
function shut(e) {
if (!contains(document.getElementById('BorderLayer'),e.relatedTarget) && !contains(document.getElementById('BubbleLayer'),e.relatedTarget) && !contains(document.getElementById('ArrowLayer'),e.relatedTarget) && !contains(document.getElementById('InvLayer'),e.relatedTarget) && typeof(icon) != "undefined" && !contains(icon,e.relatedTarget))
BubbleHide();
}
MoveBubble();